import {  defineStore } from "pinia";

export const cityInfoStore=defineStore("cityInfo",{
    state:()=>{
        return {
            cityinfo:'北京省',
            airinfo:{},
            tempinfo:{},
            flag:false,
        }
       
        
    },
    //既做同步处理也做异步处理
    actions:{
        setCityInfo(palyload:any){
            this.cityinfo=palyload;       
        },
        setAirInfo(palyload:any){
            this.airinfo=palyload;
        },
        setTempInfo(palyload:any){
            this.tempinfo=palyload;
        },
        setFlag(palyload:any){
            this.flag=palyload
        }
    },
    //计算属性，返回cityinfo的值
    getters:{
        getCityInfo():any{
            return this.cityinfo;
        },
        getAirInfo():any{
            return this.airinfo;
        },
        getTempInfo():any{
            return this.tempinfo;
        },
        getFlag():any{
            return this.flag
        }
    }
})
